package com.alibaba.druid.sql.dialect.kingbasesql.methodinvoke.imp;

import com.alibaba.druid.sql.ast.expr.SQLMethodInvokeExpr;
import com.alibaba.druid.sql.dialect.kingbasesql.methodinvoke.IMethodInvoke;
import com.alibaba.druid.sql.dialect.kingbasesql.visitor.KingbaseOutputVisitor;

public class IsNullSetMethodInvoke implements IMethodInvoke {

    @Override
    public boolean invoke(SQLMethodInvokeExpr x, KingbaseOutputVisitor visitor) {
        boolean ucase = visitor.isUppCase();

        visitor.print(ucase ? " MYISNULL (" : " myisnull (");

        // 拼接参数
        for (int i = 0; i < x.getArguments().size(); i++) {
            visitor.toPrintExpr(x.getArguments().get(i));
        }
        visitor.print(")");
        return true;
    }
}
